****APPENDIX TABLE E10-E11****

cd "$main_dir/output/tables/appendix_e"

global basic 	marital edu
global econ	    employment_status occupation income imputed_income
global design 	survey_year age language
global polit    ideology party_member

//--------------------------------------------------------
//Define relevant program
//--------------------------------------------------------

capture program drop standardize
program define standardize
	
	args depvar
	
	cap drop z*
	local varlist `depvar' wgrowth_rate_1
	foreach var of local varlist {
		egen z`var' = std(`var') if e(sample)==1
}														

end

//--------------------------------------------------------
//Read in relevant data
//--------------------------------------------------------

clear
use "$data_dir/clean/shp_final_panel.dta"

gen dummy = 1 if trust_fed_govt_med!=.
bys idpers: egen total_obs = total(dummy)

xtset idpers survey_year

cap drop sample income_sample
gen sample = 1 if live_switz==1 & total_obs>4 & total_obs!=. & age>=15 & age!=.
gen income_sample = 1 if live_switz==1 & total_obs>4 & total_obs!=. & age>=18 & age!=. & total_real_income_with_0_obs>=0.5*(age-18) & total_real_income_with_0_obs!=.

egen canton_survey_year = group(canton survey_year)

//--------------------------------------------------------
//Create Table E10
//--------------------------------------------------------

//Column 1
qui reghdfe trust_fed_govt_med wgrowth_rate_1 if sample==1 [pw = w11113], absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_fed_govt_med wgrowth_rate_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_fed_govt_med zwgrowth_rate_1 if e(sample)==1 [pw = w11113], absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, replace dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1) 

//Column 2
qui reghdfe trust_fed_govt_med wgrowth_rate_1 if sample==1 [pw = w11113], absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_fed_govt_med wgrowth_rate_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_fed_govt_med zwgrowth_rate_1 if e(sample)==1 [pw = w11113], absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1)
													   

//Column 3
qui reghdfe trust_fed_govt_med wgrowth_rate_1 wincome_growth_1 if income_sample==1 [pw = w11113], absorb(canton $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_fed_govt_med wgrowth_rate_1 wincome_growth_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_fed_govt_med zwgrowth_rate_1 zwincome_growth_1 if e(sample)==1 [pw = w11113], absorb(canton $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1 zwincome_growth_1)

//Column 4
qui reghdfe trust_fed_govt_med wgrowth_rate_1 wincome_growth_1 if income_sample==1 [pw = w11113], absorb(canton_survey_year $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_fed_govt_med wgrowth_rate_1 wincome_growth_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_fed_govt_med zwgrowth_rate_1 zwincome_growth_1 if e(sample)==1 [pw = w11113], absorb(canton_survey_year $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1 zwincome_growth_1)

//Column 5
qui reghdfe trust_others_med wgrowth_rate_1 if sample==1 [pw = w11113], absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_others_med wgrowth_rate_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_others_med zwgrowth_rate_1 if e(sample)==1 [pw = w11113], absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1) 

//Column 6
qui reghdfe trust_others_med wgrowth_rate_1 if sample==1 [pw = w11113], absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_others_med wgrowth_rate_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_others_med zwgrowth_rate_1 if e(sample)==1 [pw = w11113], absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1) 

//Column 7
qui reghdfe trust_others_med wgrowth_rate_1 wincome_growth_1 if income_sample==1 [pw = w11113], absorb(canton $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_others_med wgrowth_rate_1 wincome_growth_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_others_med zwgrowth_rate_1 zwincome_growth_1 if e(sample)==1 [pw = w11113], absorb(canton $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1 zwincome_growth_1)

//Column 8
qui reghdfe trust_others_med wgrowth_rate_1 wincome_growth_1 if income_sample==1 [pw = w11113], absorb(canton_survey_year $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
cap drop z*
local varlist trust_others_med wgrowth_rate_1 wincome_growth_1
foreach var of local varlist {
	egen z`var' = std(`var') if e(sample)==1
}
reghdfe ztrust_others_med zwgrowth_rate_1 zwincome_growth_1 if e(sample)==1 [pw = w11113], absorb(canton_survey_year $basic $design employment_status occupation imputed_income $polit idpers) cluster(idhous yob)
outreg2 using table_e10.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
													   Canton FE, Yes, ///
													   Survey Year FE, Yes, ///
													   Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1 zwincome_growth_1)

//--------------------------------------------------------
//Create Table E11
//--------------------------------------------------------

//Column 1
qui reghdfe cheat_taxes_med wgrowth_rate_1 if sample==1, absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
standardize cheat_taxes_med
reghdfe zcheat_taxes_med zwgrowth_rate_1 if e(sample)==1, absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e11.doc, replace dec(3) nocons addtext(Individual FE, Yes, ///
																Canton FE, Yes, ///
																Survey Year FE, Yes, ///
																Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1) 

//Column 2
qui reghdfe cheat_taxes_med wgrowth_rate_1 if sample==1, absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
standardize cheat_taxes_med
reghdfe zcheat_taxes_med zwgrowth_rate_1 if e(sample)==1, absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e11.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
															   Canton FE, No, ///
															   Survey Year FE, No, ///
															   Canton FE x Survey Year FE, Yes) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1)

//Column 3
qui reghdfe interest_politics_med wgrowth_rate_1 if sample==1, absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
standardize interest_politics_med
reghdfe zinterest_politics_med zwgrowth_rate_1 if e(sample)==1, absorb(canton $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e11.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
																Canton FE, Yes, ///
																Survey Year FE, Yes, ///
																Canton FE x Survey Year FE, No) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1) 													   
													   													   
//Column 4
qui reghdfe interest_politics_med wgrowth_rate_1 if sample==1, absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
standardize interest_politics_med
reghdfe zinterest_politics_med zwgrowth_rate_1 if e(sample)==1, absorb(canton_survey_year $basic $design $econ $polit idpers) cluster(idhous yob)
outreg2 using table_e11.doc, append dec(3) nocons addtext(Individual FE, Yes, ///
															   Canton FE, No, ///
															   Survey Year FE, No, ///
															   Canton FE x Survey Year FE, Yes) addstat("No. of Respondents", `=e(df_a_nested)') keep(zwgrowth_rate_1)
